]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Add some padding around window previews
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 30 Jan 2021 04:42:47 +0000 (05:42 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 1 Feb 2021 20:06:13 +0000 (21:06 +0100)
Commit 059ea64 removed the workspace padding after moving the
background into the workspace. However some whitespace around
window previews is still a good idea, and will be necessary
soon as we are about to indicate focus by slightly scaling up
the active preview, and don't want previews to be clipped by
the workspace in that case.

https://gitlab.gnome.org/Teams/Design/os-mockups/-/issues/81

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1605>

js/ui/workspace.js

index cb3c212eea0d3772a5585f75aab88a195225e5c4..ff4d4c70bf2d2b4134ac5def68c9fa267836a43c 100644 (file)
@@ -12,6 +12,7 @@ const Util = imports.misc.util;
 const { WindowPreview } = imports.ui.windowPreview;
 
 var WINDOW_PREVIEW_MAXIMUM_SCALE = 0.95;
+var MAXIMUM_PREVIEW_AREA = 0.98;
 
 var WINDOW_REPOSITIONING_DELAY = 750;
 
@@ -469,6 +470,14 @@ var WorkspaceLayout = GObject.registerClass({
             colSpacing += Math.max(leftOversize, rightOversize);
 
         if (containerBox) {
+            // add some padding around preview area
+            const [width, height] = containerBox.get_size();
+            containerBox.set_size(
+                width * MAXIMUM_PREVIEW_AREA,
+                height * MAXIMUM_PREVIEW_AREA);
+            containerBox.x1 += width * (1 - MAXIMUM_PREVIEW_AREA) / 2;
+            containerBox.y1 += height * (1 - MAXIMUM_PREVIEW_AREA) / 2;
+
             const [topOverlap, bottomOverlap] = window.overlapHeights();
             containerBox.x1 += leftOversize + topOverlap;
             containerBox.x2 -= rightOversize;